package codeformatter;

import params.ParamsController;

/**
 * Describes the current state of a {@link Formatter} class object
 */
public class State{
    private int commentaryType;
    private int indentAmount;
    private boolean isIndentNeeded;
    public State(){
        commentaryType = ParamsController.getNoCommentary();
        indentAmount = 0;
        isIndentNeeded = false;
    }
    /**
     * @return the current type of commentary in the code block
     */
    public int getCommentary(){
        return commentaryType;
    }
    /**
     * @return the current amount of indents in the code block
     */
    public int getIndentAmount(){
        return indentAmount;
    }
    /**
     * @return true if the next symbol formatted should be prevented with an indent symbol
     */
    public boolean isIndentNeeded(){
        return isIndentNeeded;
    }        
    /**
     * @param indentAmount - new value for amount of indents
     */
    public void setIndentAmount(int indentAmount){
        this.indentAmount = indentAmount;
    }
    /**
     * Increases the amount of indents by one 
     */
    public void incIndentAmount(){
        this.indentAmount ++;
    }
    /**
     * Decreases the amount of indents by one 
     */
    public void decIndentAmount(){
        this.indentAmount --;
    }
    /**
     * @param commentaryType - new value of commentary type
     */
    public void setCommentary(int commentaryType){
        this.commentaryType = commentaryType;
    }    
    /**
     * @param flag - indicates, whether or not indent before the next symbol is needed
     */
    public void setIndentNeeded(boolean flag){
        isIndentNeeded = flag;
    }   

} 

